package memento.example;

/**
 * @Author：LJ
 * @Description：
 * @Date: 2017/12/1
 * @Modified By:
 */
public class Boy {
    private String state;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    //保留一个备份
    public Memento createMemento() {
        return new Memento(state);
    }

    //回复一个备份
    public void restoreMemento(Memento memento) {
        setState(memento.getState());
    }

}
